package nl.boektrust.btsoep.shared.model;


/*
 * ONIX 2.1 list 58
 */
public enum PriceTypeCode {
	UNDEFINED,FIXED,MSRP;
	
	
	public static String stringValue(PriceTypeCode t) {
		String value = new String();
		switch (t) {
		case UNDEFINED: value = "Onbekend"; break;
		case FIXED: value = "Vaste prijs"; break;
		case MSRP: value = "Adviesprijs"; break;
		}
		return value;
		
	}
	public static PriceTypeCode parseStringIntoPriceTypeCode(String s) {
		for (PriceTypeCode t : PriceTypeCode.values()) {
			if (PriceTypeCode.stringValue(t).equals(s) == true) return t;
		}
		return UNDEFINED;
	}
	
	public static String stringValueForOnix(PriceTypeCode t) {
		String value = new String();
		if (t == null || t == PriceTypeCode.UNDEFINED) {
			System.err.println("PriceTypeCode.intValueForOnix() was called with a null argument");
			return null;
		}
		switch (t) {
		case UNDEFINED: value = "00"; break;
		case FIXED: value = "04"; break;
		case MSRP: value = "02"; break;
		}
		return value;
		
	}
}
